import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home/index.vue'
import Housing from '../views/Home/Housing'
import Live from '../views/Home/Live'
import Group from '../views/Home/Group'
import Auditor from '../views/Home/Auditor'
import Order from '../views/Home/Order'
import Information from '../views/Home/Information'
import Broker from '../views/Home/Broker'

import LiveDetail from '../views/LiveDetail'

import Login from '../views/Login'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/housing',
    children: [
      {
        path: '/housing',
        name: 'Housing',
        component: Housing,
        meta: {
          auth: ['超级管理员', '管理员', '用户']
        }
      },
      {
        path: '/live',
        name: 'Live',
        component: Live,
        meta: {
          auth: ['超级管理员', '管理员']
        }
      },
      {
        path: '/group',
        name: 'Group',
        component: Group,
        meta: {
          auth: ['超级管理员', '管理员']
        }
      },
      {
        path: '/auditor',
        name: 'Auditor',
        component: Auditor,
        meta: {
          auth: ['超级管理员', '用户']
        }
      },
      {
        path: '/order',
        name: 'Order',
        component: Order,
        meta: {
          auth: ['超级管理员', '管理员',]
        }
      },
      {
        path: '/information',
        name: 'Information',
        component: Information,
        meta: {
          auth: ['超级管理员', '用户']
        }
      },
      {
        path: '/broker',
        name: 'Broker',
        component: Broker,
        meta: {
          auth: ['超级管理员', '管理员']
        }
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/liveDetail/:id',
    name: 'LiveDetail',
    component: LiveDetail
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
